\relax 
\expandafter \gdef \csname pgfplots@legend@to@name@legendhere\endcsname {\begingroup \def \pgfplots@legend@to@name {\pgfkeysdef {/pgfplots/every axis legend}{\pgfkeysalso {cells={anchor=center},inner xsep={3pt},inner ysep={2pt},nodes={inner sep=2pt,text depth=0.15em},anchor={north east},shape={rectangle},fill={white},draw={black},at={(0.98,0.98)}}}\pgfkeysdef {/pgfplots/every legend image post}{}\def \numplots {0}}\tikzifinpicture {\pgfplots@legend@to@name }{\expandafter \ifx \csname tikzappendtofigurename\endcsname \relax \else \begingroup \tikzappendtofigurename {_crossref}\fi \tikz [/pgfplots/every legend to name picture/.try]{\pgfplots@legend@to@name }\expandafter \ifx \csname tikzappendtofigurename\endcsname \relax \else \endgroup \fi }\endgroup }
\newlabel{legendhere}{{\expandafter\protect\csname pgfplots@legend@to@name@legendhere\endcsname}{1}}
